package thermologic.core;

/**
 * Thread for perform asynchronous search of devices
 * 
 * @author Mauricio Rivadeneira
 */
public class DeviceSearchThread implements Runnable {

    private Adapter adapter = null;
    
    /**
     * Creates an DeviceSearchThread instance, when
     * the thread starts it calls the method connectAndSearch
     * of Adapter.
     * 
     * @param adapter Adapter used for device search
     */
    public DeviceSearchThread(Adapter adapter)
    {
        if(adapter == null)
        {
            throw new IllegalArgumentException("Adapter is null");
        }
        this.adapter = adapter;
    }
    
    @Override
    public void run() {
        
        adapter.connectAndSearch();
    }
}
